import { CHANNEL_SAVE_LIST, CHANNEL_SAVE_CURRENT } from '../action/actionType';

const initialState = {
  list: [],
  current: 0,
};

export default function channelReducer(state = initialState, { type, payload }) {
  switch (type) {
    case CHANNEL_SAVE_LIST:
      return {
        ...state,
        list: [...payload],
      };

    case CHANNEL_SAVE_CURRENT:
      return {
        ...state,
        current: payload,
      };
    default:
      return state;
  }
}
